// windows restore to the right size.
this._updateRegions();
- if (Meta.is_restart()) {
- // On restart, we don't do an animation.
- } else if (Main.sessionMode.isGreeter) {
+ if (Main.sessionMode.isGreeter) {
this.panelBox.translation_y = -this.panelBox.height;
} else {
this.keyboardBox.hide();
}
async _startupAnimation() {
- if (Meta.is_restart())
- return;
-
if (Main.sessionMode.isGreeter)
await this._startupAnimationGreeter();
else
-import Clutter from 'gi://Clutter';
import Gio from 'gi://Gio';
import GioUnix from 'gi://GioUnix';
import GLib from 'gi://GLib';
import * as Introspect from '../misc/introspect.js';
import * as Keyboard from './keyboard.js';
import * as MessageTray from './messageTray.js';
-import * as ModalDialog from './modalDialog.js';
import * as OsdWindow from './osdWindow.js';
import * as OsdMonitorLabeler from './osdMonitorLabeler.js';
import * as Overview from './overview.js';
locatePointer.show();
});
- global.display.connect('show-restart-message', (display, message) => {
- showRestartMessage(message);
- return true;
- });
-
- global.display.connect('restart', () => {
- global.reexec_self();
- return true;
- });
-
global.display.connect('gl-video-memory-purged', loadTheme);
global.context.connect('notify::unsafe-mode', () => {
}
}
-const RestartMessage = GObject.registerClass(
-class RestartMessage extends ModalDialog.ModalDialog {
- _init(message) {
- super._init({
- shellReactive: true,
- styleClass: 'restart-message',
- shouldFadeIn: false,
- destroyOnClose: true,
- });
-
- const label = new St.Label({
- text: message,
- x_align: Clutter.ActorAlign.CENTER,
- y_align: Clutter.ActorAlign.CENTER,
- });
-
- this.contentLayout.add_child(label);
- this.buttonLayout.hide();
- }
-});
-
-function showRestartMessage(message) {
- const restartMessage = new RestartMessage(message);
- restartMessage.open();
-}
-
class AnimationsSettings {
constructor() {
this._animationsEnabled = true;
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
-import Meta from 'gi://Meta';
import Shell from 'gi://Shell';
import St from 'gi://St';
this._internalCommands = {
'lg': () => Main.createLookingGlass().open(),
- 'r': this._restart.bind(this),
-
- // Developer brain backwards compatibility
- 'restart': this._restart.bind(this),
-
'debugexit': () => global.context.terminate(),
// rt is short for "reload theme"
this._descriptionLabel.set_text(message);
}
- _restart() {
- if (Meta.is_wayland_compositor()) {
- this._showError(_('Restart is not available on Wayland'));
- return;
- }
- this._shouldFadeOut = false;
- this.close();
- Meta.restart(_('Restarting…'), global.context);
- }
open() {
this._history.lastItem();
Wayland display name to use
-``-r``, ``--replace``
-
- Replace the running window manager
-
``--mode=MODE``
Use a specific mode, e.g. "gdm" for login screen
args.append('--force-animations')
- if options.replace:
- args.append('--replace')
-
if options.wayland or options.nested or options.headless:
args.append('--wayland')
if options.nested:
shell.wait()
return shell.returncode == 0
-def restore_shell():
- pid = os.fork()
- if (pid == 0):
- os.execlp("gnome-shell", "gnome-shell", "--replace")
- else:
- sys.exit(0)
-
def upload_performance_report(report_text):
try:
config_home = os.environ['XDG_CONFIG_HOME']
parser.add_argument("--wrap")
-parser.add_argument("-r", "--replace", action="store_true",
- help="Replace the running window manager")
parser.add_argument("-w", "--wayland", action="store_true",
help="Run as a Wayland compositor")
parser.add_argument("-n", "--nested", action="store_true",
options.extra_filter.append('Gedit')
normal_exit = run_performance_test(wrap=options.wrap)
-if normal_exit:
- if not options.hwtest and options.replace:
- restore_shell()
-else:
+if not normal_exit:
sys.exit(1)
}
static void
-shell_dbus_init (gboolean replace)
+shell_dbus_init ()
{
GDBusConnection *session;
GDBusProxy *bus;
}
request_name_flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT;
- if (replace)
- request_name_flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
shell_dbus_acquire_name (bus,
request_name_flags,
if (!(request_name_result == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER
|| request_name_result == DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER))
{
- g_printerr (SHELL_DBUS_SERVICE " already exists on bus and --replace not specified\n");
+ g_printerr (SHELL_DBUS_SERVICE " already exists on bus\n");
exit (1);
}
shell_init_debug (g_getenv ("SHELL_DEBUG"));
- shell_dbus_init (meta_context_is_replacing (context));
+ shell_dbus_init ();
shell_a11y_init ();
shell_perf_log_init ();
shell_introspection_init ();
* http://bugzilla.gnome.org/show_bug.cgi?id=357585
*/
-static int
-set_cloexec (void *data, gint fd)
-{
- if (fd >= GPOINTER_TO_INT (data))
- fcntl (fd, F_SETFD, FD_CLOEXEC);
-
- return 0;
-}
-
-#ifndef HAVE_FDWALK
-static int
-fdwalk (int (*cb)(void *data, int fd), void *data)
-{
- gint open_max;
- gint fd;
- gint res = 0;
-
-#ifdef HAVE_SYS_RESOURCE_H
- struct rlimit rl;
-#endif
-
-#ifdef __linux__
- DIR *d;
-
- if ((d = opendir("/proc/self/fd"))) {
- struct dirent *de;
-
- while ((de = readdir(d))) {
- glong l;
- gchar *e = NULL;
-
- if (de->d_name[0] == '.')
- continue;
-
- errno = 0;
- l = strtol(de->d_name, &e, 10);
- if (errno != 0 || !e || *e)
- continue;
-
- fd = (gint) l;
-
- if ((glong) fd != l)
- continue;
-
- if (fd == dirfd(d))
- continue;
-
- if ((res = cb (data, fd)) != 0)
- break;
- }
-
- closedir(d);
- return res;
- }
-
- /* If /proc is not mounted or not accessible we fall back to the old
- * rlimit trick */
-
-#endif
-
-#ifdef HAVE_SYS_RESOURCE_H
- if (getrlimit(RLIMIT_NOFILE, &rl) == 0 && rl.rlim_max != RLIM_INFINITY)
- open_max = rl.rlim_max;
- else
-#endif
- open_max = sysconf (_SC_OPEN_MAX);
-
- for (fd = 0; fd < open_max; fd++)
- if ((res = cb (data, fd)) != 0)
- break;
-
- return res;
-}
-#endif
-
-static void
-pre_exec_close_fds(void)
-{
- fdwalk (set_cloexec, GINT_TO_POINTER(3));
-}
-
-/**
- * shell_global_reexec_self:
- * @global: A #ShellGlobal
- *
- * Restart the current process. Only intended for development purposes.
- */
-void
-shell_global_reexec_self (ShellGlobal *global)
-{
- GPtrArray *arr;
- gsize len;
- MetaContext *meta_context;
-
-#if defined __linux__ || defined __sun
- char *buf;
- char *buf_p;
- char *buf_end;
- g_autoptr (GError) error = NULL;
-
- if (!g_file_get_contents ("/proc/self/cmdline", &buf, &len, &error))
- {
- g_warning ("failed to get /proc/self/cmdline: %s", error->message);
- return;
- }
-
- buf_end = buf+len;
- arr = g_ptr_array_new ();
- /* The cmdline file is NUL-separated */
- for (buf_p = buf; buf_p < buf_end; buf_p = buf_p + strlen (buf_p) + 1)
- g_ptr_array_add (arr, buf_p);
-
- g_ptr_array_add (arr, NULL);
-#elif defined __OpenBSD__
- gchar **args, **args_p;
- gint mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV };
-
- if (sysctl (mib, G_N_ELEMENTS (mib), NULL, &len, NULL, 0) == -1)
- return;
-
- args = g_malloc0 (len);
-
- if (sysctl (mib, G_N_ELEMENTS (mib), args, &len, NULL, 0) == -1) {
- g_warning ("failed to get command line args: %d", errno);
- g_free (args);
- return;
- }
-
- arr = g_ptr_array_new ();
- for (args_p = args; *args_p != NULL; args_p++) {
- g_ptr_array_add (arr, *args_p);
- }
-
- g_ptr_array_add (arr, NULL);
-#elif defined __FreeBSD__
- char *buf;
- char *buf_p;
- char *buf_end;
- gint mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, getpid() };
-
- if (sysctl (mib, G_N_ELEMENTS (mib), NULL, &len, NULL, 0) == -1)
- return;
-
- buf = g_malloc0 (len);
-
- if (sysctl (mib, G_N_ELEMENTS (mib), buf, &len, NULL, 0) == -1) {
- g_warning ("failed to get command line args: %d", errno);
- g_free (buf);
- return;
- }
-
- buf_end = buf+len;
- arr = g_ptr_array_new ();
- /* The value returned by sysctl is NUL-separated */
- for (buf_p = buf; buf_p < buf_end; buf_p = buf_p + strlen (buf_p) + 1)
- g_ptr_array_add (arr, buf_p);
-
- g_ptr_array_add (arr, NULL);
-#else
- return;
-#endif
-
- /* Close all file descriptors other than stdin/stdout/stderr, otherwise
- * they will leak and stay open after the exec. In particular, this is
- * important for file descriptors that represent mapped graphics buffer
- * objects.
- */
- pre_exec_close_fds ();
-
- meta_context = shell_global_get_context (global);
- meta_context_restore_rlimit_nofile (meta_context, NULL);
-
- meta_display_close (shell_global_get_display (global),
- shell_global_get_current_time (global));
-
- execvp (arr->pdata[0], (char**)arr->pdata);
- g_warning ("failed to reexec: %s", g_strerror (errno));
- g_ptr_array_free (arr, TRUE);
-#if defined __linux__ || defined __FreeBSD__
- g_free (buf);
-#elif defined __OpenBSD__
- g_free (args);
-#endif
-}
-
/**
* shell_global_notify_error:
* @global: a #ShellGlobal
const char *msg,
const char *details);
-void shell_global_reexec_self (ShellGlobal *global);
-
const char * shell_global_get_session_mode (ShellGlobal *global);
void shell_global_set_runtime_state (ShellGlobal *global,